<!DOCTYPE HTML>
<html>
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
  <meta charset="UTF-8">

  <meta name="description" content="">
  <meta name="keywords" content="">

  <title>分类浏览</title>

  <link rel="shortcut icon" href="favicon.ico">
  <link href="css/style.css" media="screen" rel="stylesheet" type="text/css">
  <link href="css/grid.css" media="screen" rel="stylesheet" type="text/css">
 
  <script src="js/jquery-1.7.2.min.js" ></script>
  <script src="js/html5.js" ></script>
  <script src="js/jflow.plus.js" ></script>
  <script src="js/jquery.carouFredSel-5.2.2-packed.js"></script>
  <script src="js/checkbox.js"></script>
  <script src="js/radio.js"></script>
  <script src="js/selectBox.js"></script>
    <script src="js/ajax.js"></script>


</head>
<body>
  <div class="container_12">

      <header id="branding">
          <div class="grid_3">
              <hgroup>
                  <h1 id="site_logo" ><a href="index.php" title=""><img src="images/logo.png" alt="Online Store Theme Logo"/></a></h1>
                  <h2 id="site_description">长江文艺出版社</h2>
              </hgroup>
          </div><!-- .grid_3 -->

          <div class="grid_3">
              <form class="search" action="search_result.php">
                  <input type="text" name="search" class="entry_form" value="" placeholder="输入关键词..."/>
              </form>
          </div><!-- .grid_3 -->
          <!-- 购物车简要 -->
          <div class="grid_6">
              <ul id="cart_nav">
                  <li>
                      <a class="cart_li" href="#">我的购物车</a>
                      <ul class="cart_cont">

                          <?php
                          include_once("server/CartInfo_nav.php");
                          $shops_nav = getCart_forBox();
                          if ($shops_nav == false){
                              echo "
                          <li>
                            <a href=\"#\" class=\"prev_cart\"><div class=\"cart_vert\"><img src=\"book_pic/none.png\" alt=\"\" title=\"\" /></div></a>
                            <div class=\"cont_cart\">
                              <h4>None</h4>
                              <div class=\"price\">&nbsp;None</div>
                            </div>
                            <div class=\"clear\"></div>
                          </li>
                        ";
                          }else{
                              while ($row_nav = $shops_nav->fetch_row()){
                                  echo "
                              <li>
                                <a href=\"product_page.php?id=$row_nav[0]\" class=\"prev_cart\"><div class=\"cart_vert\"><img src=\"book_pic/$row_nav[0].jpg\" alt=\"\" title=\"\" /></div></a>
                                <div class=\"cont_cart\">
                                  <h4>《$row_nav[1]》</h4>
                                  <div class=\"price\">&nbsp;￥$row_nav[2]</div>
                                </div>
                                <div class=\"clear\"></div>
                              </li>
                            ";
                              }
                          }
                          ?>

                          <li class="no_border">
                              <a href="shopping_cart.php" class="view_cart">查看购物车</a>
                              <a href="pay_order.php" class="checkout">立即购买</a>
                          </li>
                      </ul>
                  </li>
              </ul>

              <nav class="private">
                  <ul>
                      <li><a href="#" id="myAccount">用户名</a></li>
                      <li class="separator">|</li>
                      <li><a href="#">收藏夹</a></li>
                      <li class="separator">|</li>
                      <li><a href="login.php" id="user_state" onclick="user_quiz()">登 录</a></li>  <!--登录后改为退出二字-->
                  </ul>
              </nav><!-- .private -->
          </div><!-- .grid_6 -->
      </header><!-- #branding -->
<div class="clear"></div>
  </div><!-- .container_12 -->
<!-- 导航栏 -->
  <div id="block_nav_primary">
    <div class="container_12">
      <div class="grid_12">
        <nav class="primary">
          <ul>
            <li class="curent"><a href="index.php">书苑主页</a></li>
	        <li><a href="press_intro.php">长江简介</a></li>
	        <li><a href="news_list.php">新闻动态</a></li>
	        <li><a href="#">图书商城 </a>

			<ul class="sub">
                <li><a href="book_all.php">全部图书</a></li>
                <li><a href="book_catalog.php">分类浏览</a></li>
            </ul>
           </li>

            <li><a href="contact_us.php">联系我们</a></li>
          </ul>
        </nav><!-- .primary -->
      </div><!-- .grid_12 -->
    </div><!-- .container_12 -->
  </div><!-- .block_nav_primary -->

  <div class="container_12">
    <div class="grid_12">
       <div class="breadcrumbs">
	      <a href="index.php">主页</a><span>&#8250;</span><span class="current">图书分类</span><span>&#8250;</span><span class="current">文学</span>
       </div><!-- .breadcrumbs -->
    </div><!-- .grid_12 -->
  </div><!-- .container_12 -->
  
  <div class="clear"></div>
  
  <section id="main">
    <div class="container_12">
       <div id="sidebar" class="grid_3">
	      <aside id="categories_nav">
		     <h3>图书分类</h3>
		     
		     <nav class="left_menu">
			    <ul>
			    <?php include_once "operation/book_catalog.php";?>
				   <li><a href="book_catalog.php?kind=001">文学 <span>(<?php echo $count["文学"];?>)</span></a></li>
				   <li><a href="book_catalog.php?kind=002">历史 <span> (<?php echo $count["历史"];?>)</span></a></li>
				   <li><a href="book_catalog.php?kind=003">社会 <span>(<?php echo $count["社会"];?>)</span></a></li>
				   <li><a href="book_catalog.php?kind=004">教育 <span>(<?php echo $count["教育"];?>)</span></a></li>
				   <li><a href="book_catalog.php?kind=005">其他 <span>(<?php echo $count["其他"];?>)</span></a></li>
			    </ul>
		     </nav><!-- .left_menu -->
	      </aside><!-- #categories_nav -->

       </div><!-- .sidebar -->
      
       <div id="content" class="grid_9">
	      <h1 class="page_title">图书列表</h1>
	      
	      <div class="grid_product">
	      	<?php 
	      		//通过GET方式获取当前页码，如果没有设置，则设为1
	      		if(is_array($_GET)&&count($_GET)>0&&isset($_GET["page"])){
						$page = $_GET["page"];	//当前页码	
				}else
						$page = 1;
				$book_num = count($book_info);
				$page_num = $book_num/9;//页面总数
				if(!empty($book_info)){
					for($k=($page-1)*6;
                        $k<($page<$page_num?$page*6:$book_num);++$k){
			?>
		     <div class="grid_3 product">
			    <div class="prev">
				   <a href="product_page.php?id=<?php echo $book_info[$k]['id'];?>"><img src="<?php echo $book_info[$k]['picture'];?>" alt="" title="" /></a>
			    </div><!-- .prev -->
			    <h3 class="title">《<?php echo $book_info[$k]['name'];?>》</h3>
			    <div class="cart">
				   <div class="price">
					  <div class="vert">
						 <div class="price_new">￥<?php echo $book_info[$k]['price'];?></div>
						 <!-- <div class="price_old">$725.00</div> -->
					  </div>
				   </div>
				   <a href="#" class="like"></a>
				   <a href="#" class="bay"></a>
			    </div><!-- .cart -->
		     </div><!-- .grid_3 -->
            <?php }}?>
	      <div class="clear"></div>
	      
	      </div><!-- .grid_product -->
	      
	      <div class="clear"></div>
	      <?php
	      //当页码总数2时分页
	      if($page_num>1){ 
	      	if($page>1){//当前页码大于1时才有前一页
				echo "<div class=\"pagination\">
								     <ul>
									    <li class=\"prev\"><a href=\"book_catalog.php?kind=$kindid?page=$page-1\">&#8594;</a></li>
									    ";
				}
				else{//当前页码为1时无前一页
					echo "<div class=\"pagination\">
						     <ul>
							    <li class=\"prev\"><span>&#8592;</span></li>
							    ";
				}
				/**
			     * 页面总数超过5时中间的页面省略
			     * 页面总数在5以内时直接显示5个页面的页码
			     * 下面分两种情况显示
			     */
				if($page_num>7){
					if($page<5){
						//当前页之前的页码
						for($i=1;$i<$page;++$i){
							echo "<li><a href=\"book_catalog.php?kind=$kindid?page=$i\">$i</a></li>";
						}
						echo "
							    <li class=\"curent\"><a href=\"book_catalog.php?kind=$kindid?page=$page\">$page</a></li>";//当前页
							//当前页后2页的页码
						    for($i=$page+1;$i<$page+3;++$i){
								echo "
									    <li><a href=\"book_catalog.php?kind=$kindid?page=$i\">$i</a></li>";
						    }
						    echo "<li><span>...</span></li>";//直到最后一页之前的剩余页码省略
					}else{
						echo "<li><span>...</span></li>";//直到第一页之间的余页码省略
						//当前页之前的页码
						for($i=$page-2;$i<$page;++$i){
							echo "<li><a href=\"book_catalog.php?kind=$kindid?page=$i\">$i</a></li>";
						}
						echo "
							    <li class=\"curent\"><a href=\"book_catalog.php?kind=$kindid?page=$page\">$page</a></li>";//当前页
							//当前页后2页的页码
						    for($i=$page+1;$i<$page+3;++$i){
								echo "
									    <li><a href=\"book_catalog.php?kind=$kindid?page=$i\">$i</a></li>";
						    }
						    echo "<li><span>...</span></li>";//到最后一页间的页码省略
					}
				}else if(1<$page_num){
					//当前页之前的页码
					for($i=1;$i<$page;++$i){
						echo "<li><a href=\"book_catalog.php?kind=$kindid?page=$i\">$i</a></li>";
					}

					echo "
							    <li class=\"curent\"><a href=\"book_catalog.php?kind=$kindid?page=$page\">$page</a></li>";//当前页
					//当前页至最后一页的页码
				    for($i=$page+1;$i<$page_num;++$i){
						echo "
							    <li><a href=\"book_catalog.php?kind=$kindid?page=$i\">$i</a></li>";
				    }
				}
				//最后的页码
				echo "<li><a href=\"book_catalog.php?kind=$kindid?page=$page_num\"><?php echo $page_num;?></a></li>
				<li class=\"next\"><a href=\"book_catalog.php?kind=$kindid?page=$page+1\">&#8594;</a></li>
						     </ul>
					      </div><!-- .pagination -->";				
      	}?>
       </div><!-- #content -->
       
      <div class="clear"></div>
      
    </div><!-- .container_12 -->
  </section><!-- #main -->
  
  <div class="clear"></div>

   <!-- 底部信息 -->
  <footer>
    <div class="f_navigation">
      <div class="container_12">
        <div class="grid_3">
          <h3>联系我们</h3>
          <ul class="f_contact">
            <li>湖北省武汉市雄楚大街268号</li>
            <li>+86 027-87679307</li>
            <li>cjwytgc@163.com</li>
          </ul><!-- .f_contact -->
        </div><!-- .grid_3 -->
      
        <div class="grid_3">
          <h3>信息服务</h3>
          <nav class="f_menu">
            <ul>
              <li><a href="press_intro.php">关于我们</a></li>
              <li><a href="#">用户协议</a></li>
              <li><a href="#">意见反馈</a></li>
            </ul>
          </nav><!-- .private -->
        </div><!-- .grid_3 -->
        
        <div class="grid_3">
          <h3>网站服务</h3>
          <nav class="f_menu">
            <ul>
              <li><a href="contact_us.php">联系我们</a></li>
              <li><a href="#">常见问题</a></li>
              <li><a href="#">网站地图</a></li>
              
            </ul>
          </nav><!-- .private -->
        </div><!-- .grid_3 -->
        
        <div class="grid_3">
          <h3>购物指南</h3>
          <nav class="f_menu">
            <ul>
              <li><a href="#">支付方式</a></li>
              <li><a href="#">配送方式</a></li>
              <li><a href="#">售后政策</a></li>
              
            </ul>
          </nav><!-- .private -->
        </div><!-- .grid_3 -->    
      </div><!-- .container_12 -->
    </div><!-- .f_navigation -->
  </footer>
</body>
</html>